#30dayMapChallenge

CorrlCon

Alexandra Kapp

7th Nov 2020

What is the #30dayMapChallenge?

My submission to the challenge

  • ~ 15 days of the 30 days
  • today I will present 10 of the maps
  • (mostly) interactive maps with R
  • Frameworks for interactive maps:
    • Leaflet
    • Deck.gl (Package: mapdeck)

Leaflet

  • leading open-source JavaScript library
  • has been around for ~ 10 years
  • usually when you see maps online, they are made with Leaflet

Deck.gl

  • started ~ 4 years ago
  • especially great for large data and 3D views
  • R package to access deck.gl: mapdeck

Day 1

Points

plotting all + 80.000 cars in Friedrichshain-Kreuzberg

geocomputation made easy with the ‘sf’ package

  • crop polygon to outline of another polygon
streets_in_xhain <- st::st_intersection(streets_berlin, berlin) 
  • sample points in a polygon
cars <- st::st_sample(streets_xhain,size=amount_cars_xhain)

Day 8

Yellow

Plot raster data with leaflet and leafem

  • add raster data: leaflet::addRasterImage()
  • add Mouseover for raster data: leafem::addImageQuery()
leaflet() %>% 
    addProviderTiles(providers$CartoDB.DarkMatter) %>%
    addRasterImage(hours_of_sunshine, colors =  pal, group = "hours of sunshine") %>% 
    addImageQuery(hours_of_sunshine, layerId = "hours of sunshine")

Day 3

Polygons

Which boulder gym is closest to you?

Create a geospatial voronoi map

  • dismo::voronoi()

Day 14

Climate Change

How large is the area of in 2019 destroyed rain forest?

Map made with mapview. Leaflet | © OpenStreetMap contributors © CARTO

leafpm for editable polygons

  • leafpm::toolbarOptions() to draw, cut, edit and move vectors

Day 9

Monochrome

use stplanr for routing and aggregating lines

  • stplanr::route()
  • stplanr::overline()

Day 20

Population

react to clicks on map with shiny

  • clicks on leaflet maps can be accessed in shiny via an observeEvent(input$map_shape_click, {})

Day 2

Lines

Air traffic between German Airports

Origin destination with flowmap.blue

  • Flowmap.blue
  • fast and easy viz of origin destination data
  • can be done entirely without coding (with Google Sheets)
  • new: R package

Day 10

Grid

get OSM data with a single line of code via osmdata

  • OpenStreetMap overs a huge ressource on openly available geodata (streets, rivers, restaurants, stores, … )
  • this data can be retrieved with the Overpass API which is accesible with the osmdata package in R
opq(bbox = 'berlin germany') %>%
     add_osm_feature(key = 'amenity', value = c('fast_food', 'restaurant')) %>% 
     osmdata_sf ()
  • auto aggregated grids with mapdeck
    • mapdeck::add_screengrid()

Day 4

Hexagons

All traffic accidents in Stuttgart

elevation and hexagons with mapdeck

Day 22

Movement

all U-Bahns in Berlin

moving lines with mapdeck

  • mapdeck::add_trips()

Thanks for your attention!